#include "mainwindow.h"
#include "endprogram.h"
#include "ui_endprogram.h"
#include "dialog.h"
#include "program.h"
#include "bigsave.h"
#include <QMessageBox>
extern vector <Program*> prdata;
endprogram::endprogram(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::endprogram)
{
    ui->setupUi(this);
}

endprogram::~endprogram()
{
    delete ui;
}

void endprogram::on_pushButton_clicked()
{
    this->close();
    Dialog* p=new(Dialog);
    p->show();
}

void endprogram::on_pushButton_2_clicked()
{
    int r=0;
    QString str;
    str=ui->lineEdit->text();
    if(str!=""){
    for(unsigned int i=0;i<prdata.size();i++){
        if(prdata[i]->ifhave(str)){
            r=1;
            if(prdata[i]->ifover()==0&&prdata[i]->agreeornot()==0){
                prdata[i]->agree(1);
                bigsave();
                QMessageBox::information(this,"提示","请等待审核");
            }
            else if(prdata[i]->ifover()==0){
                QMessageBox::information(this,"提示","此项目正在审核");
            }
        else{
                QMessageBox::information(this,"提示","此项目已完成");
            }
            break;
        }
    }
    if(r==0){
        QMessageBox::critical(this,"错误","无此项目");
    }}
}
